Added some DPRINTK statements, for debugging.
authoremellor@ewan <emellor@ewan>
Tue, 4 Oct 2005 10:27:37 +0000 (11:27 +0100)
committeremellor@ewan <emellor@ewan>
Tue, 4 Oct 2005 10:27:37 +0000 (11:27 +0100)
1  2 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c

index c68e7f545acacfd591e28faebc00a263fb0aa04c,c68e7f545acacfd591e28faebc00a263fb0aa04c..4134c4d71a1f1a070d6ef6b8d0036b5f97eb0dd4
@@@ -63,13 -63,13 +63,23 @@@ static void frontend_changed(struct xen
        struct backend_info *be
                = container_of(watch, struct backend_info, watch);
  
++      DPRINTK("frontend_changed: %s.\n", be->frontpath);
++
        /* If other end is gone, delete ourself. */
        if (node && !xenbus_exists(be->frontpath, "")) {
++              DPRINTK("Frontend has disappeared; unregistering device.\n");
                device_unregister(&be->dev->dev);
                return;
        }
--      if (be->blkif == NULL || be->blkif->status == CONNECTED)
++      if (be->blkif == NULL) {
++              DPRINTK("blkif is null; doing nothing.\n");
                return;
++      }
++
++      if (be->blkif->status == CONNECTED) {
++              DPRINTK("blkif is CONNECTED; doing nothing.\n");
++              return;
++      }
  
        err = xenbus_gather(be->frontpath, "ring-ref", "%lu", &ring_ref,
                            "event-channel", "%u", &evtchn, NULL);
@@@ -132,10 -132,10 +142,11 @@@ again
  
        xenbus_dev_ok(be->dev);
  
++      DPRINTK("frontend_changed(%s) finished OK.\n", be->frontpath);
        return;
--
   abort:
        xenbus_transaction_end(1);
++      DPRINTK("frontend_changed(%s) aborted.\n", be->frontpath);
  }
  
  /* 
@@@ -152,9 -152,9 +163,13 @@@ static void backend_changed(struct xenb
                = container_of(watch, struct backend_info, backend_watch);
        struct xenbus_device *dev = be->dev;
  
++      DPRINTK("backend_changed: %s\n", watch->node);
++
        err = xenbus_scanf(dev->nodename, "physical-device", "%li", &pdev);
--      if (XENBUS_EXIST_ERR(err))
++      if (XENBUS_EXIST_ERR(err)) {
++              DPRINTK("physical-device node exists; doing nothing.\n");
                return;
++      }
        if (err < 0) {
                xenbus_dev_error(dev, err, "reading physical-device");
                return;
        }
  
        if (be->blkif == NULL) {
++              DPRINTK("be->blkif is null; creating VBD.\n");
++
                /* Front end dir is a number, which is used as the handle. */
                p = strrchr(be->frontpath, '/') + 1;
                handle = simple_strtoul(p, NULL, 0);
                /* Pass in NULL node to skip exist test. */
                frontend_changed(&be->watch, NULL);
        }
++      else {
++              DPRINTK("be->blkif is non-null; doing nothing.\n");
++      }
++
++      DPRINTK("backend_changed(%s) finished OK.\n", watch->node);
  }
  
  static int blkback_probe(struct xenbus_device *dev,
                            "frontend-id", "%li", &be->frontend_id,
                            "frontend", NULL, &frontend,
                            NULL);
--      if (XENBUS_EXIST_ERR(err))
++      if (XENBUS_EXIST_ERR(err)) {
++              DPRINTK("blkback_probe: %s does not exist", dev->nodename);
                goto free_be;
++      }
        if (err < 0) {
                xenbus_dev_error(dev, err,
                                 "reading %s/frontend or frontend-id",
                 * then our bus-id is no longer valid and we need to
                 * destroy the backend device.
                 */
++              DPRINTK("blkback_probe: failed to get frontend path and ID; "
++                      "destroying backend device");
                err = -ENOENT;
                goto free_be;
        }